<?php

namespace App\Admin\Actions\ShopProduct;

use App\Library\Logic\OperateLogLogic;
use App\Library\Models\AdminShopProductModel;
use Encore\Admin\Actions\Response;
use Encore\Admin\Actions\RowAction;
use Encore\Admin\Facades\Admin;
use Exception;

class ShopProductRefreshAction extends RowAction
{
    public $name = '刷新';

    /**
     * handle
     * @param AdminShopProductModel $model
     * @return Response
     * @throws Exception
     */
    public function handle(AdminShopProductModel $model): Response
    {
        mq('shopProductChange', $model->serial_number);
        sleep(2);
        return $this->response()->success('操作成功')->refresh();
    }

    public function dialog(): void
    {
        $this->confirm('确定刷新吗?');
    }
}
